package com.zhen.strategy.menu;

public enum BusiNewEnum {
    BUSI_ORDER("order", Invoke.INVOKE_1), BUSI_PAY("pay", Invoke.INVOKE_2);
    private String busiType;
    private Invoke invoke;

    BusiNewEnum(String busiType, Invoke invoke) {
        this.busiType = busiType;
        this.invoke = invoke;
    }

    public String getBusiType() {
        return busiType;
    }

    public void setBusiType(String busiType) {
        this.busiType = busiType;
    }

    public Invoke getInvoke() {
        return invoke;
    }

    public void setInvoke(Invoke invoke) {
        this.invoke = invoke;
    }

    public enum Invoke {
        INVOKE_1("orderServiceImpl", "callOrder2"), INVOKE_2("OrderServiceImpl", "callPay");
        private String service;

        Invoke(String service, String method) {
            this.service = service;
            this.method = method;
        }

        private String method;

        public String getService() {
            return service;
        }

        public void setService(String service) {
            this.service = service;
        }

        public String getMethod() {
            return method;
        }

        public void setMethod(String method) {
            this.method = method;
        }
    }

    // 根据busiType获取enum对象
    public static BusiNewEnum getEnumByBusiType(String busiType) {
        BusiNewEnum[] values = BusiNewEnum.values();
        for (BusiNewEnum temp : values) {
            if (temp.getBusiType().equals(busiType)) {
                return temp;
            }
        }
        return null;
    }
}
